<template>
  <div>
    <!--引用表格-->
    <BasicTable @register="registerTable" :rowSelection="rowSelection">
      <!--插槽:table标题-->
      <!--操作栏-->
      <!--字段回显插槽-->
      <template #tableTitle>
        <a-button type="primary" v-auth="'order:uf_mall_order:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出 </a-button>
        <!-- 高级查询 -->
      </template>
      <template #bodyCell="{ column, record, index, text }"></template>
    </BasicTable>
  </div>
</template>

<script lang="ts" name="order-ufMallOrderDetail" setup>
  import { ref, reactive, computed, unref } from 'vue';
  import { BasicTable, useTable, TableAction } from '/@/components/Table';
  import { useModal } from '/@/components/Modal';
  import { useListPage } from '/@/hooks/system/useListPage';
  import { columns, searchFormSchema, superQuerySchema } from './UfMallOrderDetail.data';
  import {
    list,
    deleteOne,
    batchDelete,
    getImportUrl,
    getExportUrl,
    getExportBatchDeliveryTemplateXls,
    getImportBatchDeliveryExcel, listDetail, listItemDetail, getDetailExportUrl
  } from "./UfMallOrder.api";
  import { useUserStore } from '/@/store/modules/user';
  import UfMallOrderDetailDrawer from '@/views/order/components/UfMallOrderDetailDrawer.vue';
  import UfMallOrderRefundDrawer from '@/views/order/components/UfMallOrderRefundDrawer.vue';
  import { useDrawer } from '@/components/Drawer';
  import { useMethods } from '@/hooks/system/useMethods';

  const queryParam = reactive<any>({});
  const checkedKeys = ref<Array<string | number>>([]);
  const userStore = useUserStore();
  //注册table数据
  const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
    tableProps: {
      title: '商品销售情况',
      api: listItemDetail,
      columns,
      canResize: false,
      showSummary: true,
      formConfig: {
        //labelWidth: 120,
        schemas: searchFormSchema,
        autoSubmitOnEnter: true,
        showAdvancedButton: true,
        fieldMapToNumber: [],
        fieldMapToTime: [
          ['createTimeFieldTime', ['createTimeStart', 'createTimeEnd'], 'YYYY-MM-DD'],
          ['payTimeFieldTime', ['payTimeStart', 'payTimeEnd'], 'YYYY-MM-DD'],
        ],
      },
      actionColumn: {
        width: 200,
        fixed: 'right',
        ifShow: false,
      },
      beforeFetch: (params) => {
        return Object.assign(params, queryParam);
      },
    },
    exportConfig: {
      name: '商品销售情况',
      url: getDetailExportUrl,
      params: queryParam,
    },
  });

  const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;

  // 高级查询配置
  const superQueryConfig = reactive(superQuerySchema);

  const { handleExportXls } = useMethods();

</script>

<style lang="less" scoped>
  :deep(.ant-picker),
  :deep(.ant-input-number) {
    width: 100%;
  }
</style>
